package com.spring.forum.service;

import com.spring.forum.mapper.BlogMapper;
import com.spring.forum.model.BlogInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {

    @Autowired
    private BlogMapper blogMapper;

    public List<BlogInfo> getBlogList() {
        return blogMapper.selectAllBlog();
    }

    public BlogInfo getBlogById(Integer blogId) {
        return blogMapper.selectBlogById(blogId);
    }

    public void insertBlog(BlogInfo blogInfo) {
        blogMapper.insertBlog(blogInfo);
    }

    public Integer update(BlogInfo blogInfo) {
        return blogMapper.updateBlog(blogInfo);
    }
}
